<?php

class Application_Model_Visitas extends Sgit_Model
{  
    protected $_name = 'visitas';
    protected $_primary = 'id';
    protected $_profiler = FALSE;
   
    
    function myreplace($controller,$action,$idZona,$id_user){
        
        $idZona=($idZona) ? $idZona : 0;
        
        $action_no_registradas=array('insertar','editar','error');
        $controller_no_registradas=array('login','error');
        
        if(in_array($controller,$controller_no_registradas)) return true;
        if(in_array($action,$action_no_registradas)) return true;
        
        
        
        
        $sql="INSERT INTO visitas (controller,action,idZona,id_user,created_on) VALUES ('$controller','$action',$idZona,$id_user,NOW()) ON DUPLICATE KEY UPDATE  n = n+1,updated_on=NOW()";
        
        $this->getAdapter()->query($sql);
    }
    
}  




